package yunhe.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONArray;
import org.json.JSONObject;

import yunhe.biz.IProcureBiz;
import yunhe.biz.impl.ProcureBizImpl;
import yunhe.entity.Purchase;
import yunhe.entity.PurchaseAppend;
import yunhe.entity.Sale;
import yunhe.entity.SaleAppend;

@WebServlet(name = "GetPurchaseDate",urlPatterns ="/GetPurchaseDate")
public class GetPurchaseDate extends HttpServlet
{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException
{
	doPost(req,resp);
}

@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException
	{
	
	 String pursId=req.getParameter("pursId");
	 
	 
	 IProcureBiz ip=new ProcureBizImpl();

	 
	  if (pursId!=null){
			List<PurchaseAppend> list=ip.selectPurchaseAppend(pursId);
			 JSONArray ja=new JSONArray();
			 for (PurchaseAppend s:list){
	                JSONObject jo=new JSONObject(s);
	                ja.put(jo);
	            }
			 System.out.println(ja.toString());
		     resp.getWriter().print(ja.toString());	  
	  }
	}
}
	
		
	

